package com.bolt.admin.module.quartz.service;

import com.bolt.admin.module.quartz.dto.JobLogDTO;
import com.bolt.admin.module.quartz.dto.converter.JobLogConverter;
import com.bolt.admin.module.quartz.entity.JobLogEntity;
import com.bolt.admin.module.quartz.repository.JobLogRepository;
import com.bolt.support.base.service.BaseService;
import com.bolt.support.spring.jpa.repository.BasicJpaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Auto Generate Javadoc
 *
 * @author 日期:2020-10-12 09:50:16
 *         定时任务日志
 **/
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class JobLogService extends BaseService <JobLogEntity, Long> {

    @Autowired
    private JobLogRepository logRepository;

    @Override
    protected BasicJpaRepository <JobLogEntity, Long> getRepository() {
        return logRepository;
    }

    @Transactional(rollbackFor = Exception.class)
    public void saveOrUpdate(JobLogDTO dto) {
        JobLogEntity entity = JobLogConverter.toEntity(dto);
        save(entity);
    }
}
